load("@rules_cc//cc:defs.bzl", "cc_library")

package(default_visibility = ["//:__subpackages__"])

cc_library(
    name = "include",
    hdrs = [
        "TXMPFiles.hpp",
        "TXMPIterator.hpp",
        "TXMPMeta.hpp",
        "TXMPUtils.hpp",
        "XMP.hpp",
        "XMP.incl_cpp",
        "XMPCommon/XMPCommonDefines.h",
        "XMPCommon/XMPCommonErrorCodes.h",
        "XMPCommon/XMPCommonFwdDeclarations.h",
        "XMPCommon/XMPCommonLatestInterfaceVersions.h",
        "XMPCore/XMPCoreDefines.h",
        "XMPCore/XMPCoreErrorCodes.h",
        "XMPCore/XMPCoreFwdDeclarations.h",
        "XMPCore/XMPCoreLatestInterfaceVersions.h",
        "XMP_Const.h",
        "XMP_Environment.h",
        "XMP_IO.hpp",
        "XMP_UnixEndian.h",
        "XMP_Version.h",
    ],
    # Dependent targets also need these set.
    defines = ["HAVE_STDINT_H"] + select({
        "@platforms//os:linux": [
            "UNIX_ENV",
            "XMP_UNIXBuild",
        ],
        "@platforms//os:macos": [
            "MAC_ENV",
            "XMP_MacBuild",
        ],
    }),
    include_prefix = "exempi",
    includes = [""],
    linkopts = [
        # Debian11 and older Ubuntu versions need these.
        "-lpthread",
        "-ldl",
    ] + select({
        "@platforms//os:macos": [
            "-framework",
            "CoreServices",
        ],
        "//conditions:default": [],
    }),
)
